<?php
// +----------------------------------------------------------------------
// | EtrolPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Author: Author: LJQ <liujiqi@etrol.com> 
// +----------------------------------------------------------------------

namespace app\inspection\controller;

use app\common\controller\Admin;
use app\inspection\controller\api\Record as RecordApi;
use app\admin\controller\ajax\Library as LibarayAjax;
use app\inspection\controller\api\Item;
/**
 * 巡检任务管理
 * @package app\rescue
 */
class Record  extends Admin

{
    
    protected $api;
    protected $property;
    
	public function _initialize()
	{
		parent::_initialize();
		$this->api = new RecordApi();
		$this->property = new LibarayAjax();
	}
    /**
     * 首页
     * @return Json/View
     */
   	public function index() {
   	  if(IS_AJAX){
   	  	$itemList = $this->api->recordList();
   	  	return $itemList;
   	  }
   	  //单位列表
   	  $enterpriseList = model('basic/Enterprise')->column('fullName','id');
   	  $this->assign('enterpriseList',$enterpriseList);
      return $this->fetch();
 	}
 	

 	/**
 	 * 巡检项目查询
 	 * @return Json
 	 */
 	public function search() {
 		if(IS_AJAX){
 			$itemList = $this->api->search(input('keyword'),input('enterpriseId'),input('start'),input('end'));
 			return $itemList;
 		}
 	}
}
